package cn.kgc.airquality.airquality.controller;

import cn.kgc.airquality.airquality.pojo.Quality;
import cn.kgc.airquality.airquality.pojo.ResultEntity;
import cn.kgc.airquality.airquality.service.impl.QualityService;
import com.github.pagehelper.PageInfo;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author shkstart
 * @create 2020-05-20 10:21
 */
@RestController
public class QualityController {
    @Resource
    QualityService qualityService;

    @RequestMapping("/selectQuality")
    public ResultEntity<PageInfo<Quality>> selectEntry(@RequestParam(value = "districtId", required = false, defaultValue = "0") Integer districtId,
                                                       @RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
                                                       @RequestParam(value = "pageSize", required = false, defaultValue = "6") Integer pageSize) {
        PageInfo<Quality> pageInfo = qualityService.select(pageNum, pageSize, districtId);
        return ResultEntity.successWithoutData(pageInfo);
    }
}
